#pragma once


// FListCtrl

class FListCtrl : public CListCtrl
{
	DECLARE_DYNAMIC(FListCtrl)

public:
	FListCtrl();
	virtual ~FListCtrl();

protected:
	DECLARE_MESSAGE_MAP()
	afx_msg   void   OnNMCustomdraw(NMHDR*,   LRESULT*); 
    afx_msg void OnDBLClick(NMHDR* pNMHDR, LRESULT* pResult);
	//afx_msg void OnLClick(NMHDR* pNMHDR, LRESULT* pResult);
	//afx_msg void OnItemChanged(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnKillFocus();
	afx_msg UINT OnGetDlgCode();
	afx_msg void OnUpdateListEdit();
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
protected:
	int m_nItemHeight;
	int m_row,m_column;
	int m_oldrow,m_oldcolumn;
	CEdit m_edit;
	deque<unsigned int> m_dequeStaticColumn;
	CRect m_selectedrect;
	CFont m_fontEdit;
public:
	void SetItemHeight(UINT nHeight);
	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
	void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);\
	int InsertCol( int nCol, LPCTSTR lpszColumnHeading, int nFormat = LVCFMT_LEFT, int nWidth = -1, int nSubItem = -1, bool isStatic = false);
	void AddStaticColumn(unsigned int nColumn){m_dequeStaticColumn.push_back(nColumn);}

protected:
	void GetCellRect();
	void ShowModifyEdit();
	virtual void PreSubclassWindow();
public:
	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
public:
	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
};


